<template>
    <div>
        <el-row class="headclass">
            <div class="logodiv">
                <img src="../../assets/img/logo.png" class="headlogo"/>
                <div class="logotext">家幼百宝箱</div>
            </div>
            <div class="headtool">
                <div class="mynetdisk">我的云盘</div>
                <div class="loginbtn" @click="openlogin">登录/注册</div>
            </div>
        </el-row>

        <el-dialog
                :visible.sync="loginmodal"
                :show-close=false
                width="300pt"
                >
            <div>
                <div :hidden="showpart != 0">
                    <div style="padding-left: 30px;padding-right: 30px;">
                        <div class="loginwelcome">欢迎登陆</div>
                        <div class="inputclass"><el-input  placeholder="家幼百宝箱 APP 注册手机号"></el-input></div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入手机号</div>
                            </div>
                        </div>

                        <div :hidden="loginmeth != 0">
                            <div class="inputclass"><el-input  placeholder="请输入密码" show-password></el-input></div>
                            <div class="errortip">
                                <div>
                                    <img src="../../assets/img/error.png"/>
                                    <div class="errortxt">请输入密码</div>
                                </div>
                            </div>
                        </div>

                        <div :hidden="loginmeth != 1">
                            <div class="inputclass messagetool" style="overflow: hidden;">
                                <div class="messageinput">
                                    <el-input  placeholder="短信验证码"></el-input>
                                </div>
                                <div class="messagebtn" :class="{active:isactive}" @click="getcode">{{messagetxt}}</div>
                            </div>
                            <div class="errortip">
                                <div>
                                    <img src="../../assets/img/error.png"/>
                                    <div class="errortxt">请输入验证码</div>
                                </div>
                            </div>
                        </div>

                        <div class="loginmodalbtn">登录</div>
                        <div class="forgetdiv"><span class="forgetbtn" @click="goforget">忘记密码？</span></div>
                    </div>
                    <div class="logintool">
                        <div class="left" @click="goregist">账号注册</div>
                        <div :hidden="loginmeth != 0" class="right" @click="changeloginmeth(1)">短信验证码登录</div>
                        <div :hidden="loginmeth != 1" class="right" @click="changeloginmeth(0)">密码登录</div>
                    </div>
                </div>
                <div :hidden="showpart != 1">
                    <div style="padding-left: 30px;padding-right: 30px;padding-bottom: 20px;">
                        <div class="loginwelcome">注册账号</div>
                        <div class="inputclass"><el-input  placeholder="请输入手机号"></el-input></div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入手机号</div>
                            </div>
                        </div>
                        <div class="inputclass"><el-input  placeholder="请输入密码(不少于6位)" show-password></el-input></div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入密码</div>
                            </div>
                        </div>
                        <div class="inputclass messagetool" style="overflow: hidden;">
                            <div class="messageinput">
                                <el-input  placeholder="短信验证码"></el-input>
                            </div>
                            <div class="messagebtn" :class="{active:isactive}" @click="getcode">{{messagetxt}}</div>
                        </div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入验证码</div>
                            </div>
                        </div>
                        <div class="loginmodalbtn">注册</div>
                        <div class="forgetdiv" ><span class="forgetbtn" @click="gologin">已有账号，去登录</span></div>
                        <div></div>
                    </div>
                </div>
                <div :hidden="showpart != 2">
                    <div style="padding-left: 30px;padding-right: 30px;padding-bottom: 20px;">
                        <div class="loginwelcome">找回密码</div>
                        <div class="inputclass"><el-input  placeholder="请输入手机号"></el-input></div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入手机号</div>
                            </div>
                        </div>


                        <div class="inputclass messagetool" style="overflow: hidden;">
                            <div class="messageinput">
                                <el-input  placeholder="短信验证码"></el-input>
                            </div>
                            <div class="messagebtn" :class="{active:isactive}" @click="getcode">{{messagetxt}}</div>
                        </div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入验证码</div>
                            </div>
                        </div>

                        <div class="inputclass"><el-input  placeholder="请输入密码(不少于6位)" show-password></el-input></div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入密码</div>
                            </div>
                        </div>

                        <div class="inputclass"><el-input  placeholder="请再次输入密码" show-password></el-input></div>
                        <div class="errortip">
                            <div>
                                <img src="../../assets/img/error.png"/>
                                <div class="errortxt">请输入密码</div>
                            </div>
                        </div>
                        <div class="loginmodalbtn">确定</div>
                        <div class="forgetdiv" ><span class="forgetbtn" @click="gologin">返回登录</span></div>
                        <div></div>
                    </div>
                </div>
            </div>
        </el-dialog>
    </div>
</template>
<script>
    export default {
        data(){
            return{
                loginmodal:false,
                showpart:0,
                loginmeth:0,
                messagetxt:'获取验证码',
                count:60,
                timer:null,
                isactive:false
            }
        },
        beforeMount(){

        },
        methods:{
            openlogin:function () {
                this.loginmodal = true
            },
            goregist:function () {
                this.showpart = 1
            },
            gologin:function () {
                this.showpart = 0
            },
            changeloginmeth:function (meth) {
                this.loginmeth = meth
            },
            goforget:function () {
                this.showpart = 2
            },
            getcode:function () {
                if(!this.isactive){
                    this.count = 60
                    this.messagetxt = "重新发送("+this.count+")"
                    this.isactive = true
                    this.timer = setInterval(res=>{
                        this.count = this.count-1
                        if(this.count<0){
                            this.isactive = false
                            this.messagetxt = "重新发送"
                            clearInterval(this.timer)
                        }else{
                            this.messagetxt = "重新发送("+this.count+")"
                        }
                    },1000)
                }

            }
        }

    }
</script>
<style>
.headclass{
    height: 60pt;
    text-align: left;
}
.logodiv{
    display: inline-block;
    height: 60pt;
    vertical-align: top;
}
.headlogo{
    width:40pt;
    height: 40pt;
    vertical-align: top;
    margin-left: 20pt;
    margin-top: 10pt;
}
.logotext{
    display: inline-block;
    line-height: 60pt;
    vertical-align: top;
    padding-left: 10pt;
    color: #363636;
    font-size: 20pt;
}
.headtool{
    float: right;
    height: 40pt;
    margin-top: 10pt;
    vertical-align: top;
    margin-right: 20pt;
}
.mynetdisk{
    color:#414141;
    font-size: 14pt;
    cursor: pointer;
    line-height: 40pt;
    margin-right: 60pt;
    display: inline-block;
}
.loginbtn{
    color: #fff;
    font-size: 13pt;
    cursor: pointer;
    display: inline-block;
    line-height: 40pt;
    border-radius: 4pt;
    background-color: #339FFD;
    width: 100pt;
    text-align: center  ;
}
.el-dialog{
    border-radius: 6pt!important;
}
.loginwelcome{
    color:#191C20;
    font-size: 18pt;
    text-align: left;
    margin-bottom: 30pt;
}
.el-dialog__body{
    padding: 10px 0px 0px 0px!important;
}

.loginmodalbtn{
    font-size: 12pt;
    background-color: #339FFD;
    height: 40px;
    line-height: 40px;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15pt;
}
.forgetdiv{
    text-align: left;
    margin-bottom: 20pt;
}
.forgetbtn{
    color: #72787F;
    font-size: 12pt;
    cursor: pointer;
}
.logintool{
    position: relative;
    overflow: hidden;
    background-color: #F4F9FE;
    height: 50pt;
    border-bottom-left-radius: 6pt;
    border-bottom-right-radius: 6pt;
}
.logintool .left{
    float: left;
    color:#339FFD;
    padding-left: 30px;
    font-size: 12pt;
    line-height: 50pt;
    cursor: pointer;
}
.logintool .right{
    float: right;
    color:#339FFD;
    padding-right: 30px;
    font-size: 12pt;
    line-height: 50pt;
    cursor: pointer;
}
.errortip{
    height: 25pt;
    text-align: left;
}
.errortxt{
    line-height: 25pt;
    display: inline-block;
    padding-left: 5pt;
    font-size: 9pt;
    color:#F44848;
}
.errortip  img{
    width: 10pt;
    height: 10pt;
    vertical-align: top;
    margin-top: 7.5pt;
}
.messagetool{
    border-radius: 4px;
    border: 1px solid #DCDFE6;
    height: 40px;
}
.messageinput{
    height: 40px;
    float:left;
    width: 50%;
    border: none;
    font-size: 14px;
}
.messageinput .el-input__inner{
    border: none!important;
}
.messagebtn{
    width: 35%;
    float: right;
    margin-right: 5px;
    line-height: 30px;
    text-align: center;
    color: #FFFFFF;
    font-size: 11pt;
    background-color: #339FFD;
    border-radius: 4pt;
    margin-top: 5px;
    cursor: pointer;
}
.messagebtn.active{
    background-color: #D3D5D7;
    color: #fff;
}
</style>
